package com.zephyr.vchcenter.bpm.decision;

import org.apache.log4j.Logger;

import com.hiaward.bpm.context.ServiceContext;
import com.hiaward.bpm.exception.ParameterException;
import com.hiaward.bpm.exception.RuleException;
import com.hiaward.bpm.exception.ServiceException;
import com.hiaward.bpm.rule.Decision;
import com.zephyr.vchcenter.bean.Voucher;
import com.zephyr.vchcenter.dao.IBaseDao;
import com.zephyr.vchcenter.helper.SpringHelper;
import com.zephyr.vchcenter.service.impl.CreateProcessImpl;

public class NeedAuditVerifyDecisionHandler extends Decision {
	private final Logger log=Logger.getLogger(NeedAuditVerifyDecisionHandler.class);
	@Override
	public void exceptionHandle(ServiceContext arg0) {
		
	}
	@Override
	public String make(ServiceContext arg0) throws RuleException,
			ServiceException, ParameterException {
		String vchsid=(String)arg0.getInputParameterValue("vchsid");
		 IBaseDao dao=(IBaseDao)SpringHelper.getBean("baseDao");
         Voucher voucher=(Voucher)dao.findById("Voucher",vchsid);
         String chkstate=voucher.getChkstate();
         String transition=null;
         if("2".equals(chkstate)){
        	 log.debug("转向join");
        	 transition="not to auditVerify";
         }
         if("3".equals(chkstate)){
        	 log.debug("转向审票复核");
        	 transition="to auditVerify";
         }
         if("5".equals(chkstate)){
        	 log.debug("转向财政户审票");
        	 transition="to financialAudit";
         }
		return transition;
	}

}
